﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QRCodeTools {
    public partial class SelectRectangle<T> : BorderRectangle
        where T : class {

        private Button SelectButton;
        private T LinkObject;

        public event Action<T> Selected;

        public SelectRectangle(T linkObject) : base() {
            LinkObject = linkObject;
            InitializeComponent();

            this.SuspendLayout();
            SelectButton = new Button {
                Name = "SelectButton",
                Text = "选择此二维码",
                AutoSize = true,
                UseVisualStyleBackColor = true,
            };
            SelectButton.Click += SelectButton_Click;

            Controls.Add(SelectButton);
            this.ResumeLayout(false);
        }

        private void SelectButton_Click(object sender, EventArgs e) {
            SelectButton.Text = "OH!";
            Selected?.Invoke(LinkObject);
        }

    }
}
